---
import LayoutMain from "@layouts/LayoutMain.astro";
import LayoutMainBottom from "@layouts/LayoutMainBottom.astro";
import LayoutMainBottomLeft from "@layouts/LayoutMainBottomLeft.astro";
import LayoutMainBottomRight from "@layouts/LayoutMainBottomRight.astro";
import LayoutMainTop from "@layouts/LayoutMainTop.astro";
import CommonTop from "@components/common/CommonTop.astro";
import CategoryTree from "./CategoryTree.astro";
import CategoryList from "./CategoryList.astro";
import AsideNotice from "../common/aside/AsideNotice.astro";
import AsideAuthor from "../common/aside/AsideAuthor.astro";
import AsideComment from "../common/aside/AsideComment.astro";
import AsideWebInfo from "../common/aside/AsideWebInfo.astro";
import AsideHotTag from "../common/aside/AsideHotTag.astro";
import AsideArticleList from "../common/aside/AsideArticleList.astro";
import LayoutFooter from "@layouts/LayoutFooter.astro";
import CommonTool from "@components/common/CommonTool.astro";
import CommonFooter from "@components/common/CommonFooter.astro";


---

<th:block
  th:with="categoryStyle=${webConfig['oly.web.theme.nice.category.style']}"
> 
  <th:block
    th:if="${categoryStyle=='tree' && categoryId!=null}"
    th:with="categoryTree=${@categoryTag.treeCmsCategory(nodeType,categoryId[0],themeName)}"
  >
    <LayoutMain>
      <LayoutMainTop>
        <th:block
          th:if="${categoryTree!=null}"
          th:with="rando=${#numbers.formatDecimal(T(java.lang.Math).floor(T(java.lang.Math).random()*10),1,0)},
          bg=${#strings.isEmpty(categoryTree.categoryIcon)?('/nice/static/images/thumbs/'+rando+'.jpg'):categoryTree.categoryIcon}"
        >
          <CommonTop
            bgImg="${bg}"
          >
            <div class="grid grid-cols-6 gap-4">
              <div class="col-start-2 col-span-4 text-center z-10">
                <h1
                  class="inline-block mb-2 text-3xl font-extrabold tracking-tight mt-36 text-gray-900 dark:text-white"
                  th:text="${categoryTree.categoryName}"
                >
                </h1>
                <p
                  class="mb-4 text-lg text-gray-600 dark:text-gray-400"
                  th:text="${categoryTree.remark}"
                >
                  介绍
                </p>
              </div>
            </div>
          </CommonTop>
        </th:block>
        <th:block th:unless="${categoryTree!=null}" th:with="bgUrl=${'/nice/static/images/thumbs/'+#numbers.formatDecimal(T(java.lang.Math).floor(T(java.lang.Math).random()*10),1,0)+'.jpg'}">
          <CommonTop
            bgImg="${bgUrl}"
          >
            <div class="grid grid-cols-6 gap-4">
              <div class="col-start-2 col-span-4 text-center z-10">
                <h1
                  class="inline-block mb-2 text-3xl font-extrabold tracking-tight mt-36 text-gray-900 dark:text-white"
                >
                  没有找到任何数据！
                </h1>
                <p class="mb-4 text-lg text-gray-600 dark:text-gray-400">
                  请联系管理员或者稍后重试!
                </p>
              </div>
            </div>
          </CommonTop>
        </th:block>
      </LayoutMainTop>
    </LayoutMain>
    <LayoutMainBottom>
      <LayoutMainBottomLeft>
        <CategoryTree />
      </LayoutMainBottomLeft>
      <LayoutMainBottomRight >
        <AsideAuthor />

        <AsideComment />

        <AsideNotice />

        <AsideHotTag />

        <AsideArticleList />

        <AsideWebInfo />
      </LayoutMainBottomRight>
    </LayoutMainBottom>
  </th:block>
  
  <th:block
    th:unless="${categoryStyle=='tree' && categoryId!=null}"
    th:with="categoryList=${categoryId==null?@categoryTag.listCmsCategory(nodeType,themeName):@categoryTag.listCmsCategory(nodeType,categoryId[0]
,themeName)}"
  >
    <LayoutMain>
      <LayoutMainTop>
        <th:block
          th:if="column!=null"
          th:with="rando=${#numbers.formatDecimal(T(java.lang.Math).floor(T(java.lang.Math).random()*10),1,0)},
        bg=${#strings.isEmpty(column.columnIcon)?('/nice/static/images/thumbs/'+rando+'.jpg'):column.columnIcon}"
        >
          <CommonTop bgImg="${bg}">
            <div class="grid grid-cols-6 gap-4">
              <div class="col-start-2 col-span-4 text-center z-10">
                <h1
                  class="inline-block mb-2 text-3xl font-extrabold tracking-tight mt-36 text-gray-900 dark:text-white"
                  th:text="${column.columnName}"
                >
                </h1>
                <p
                  class="mb-4 text-lg text-gray-600 dark:text-gray-400"
                  th:text="${column.remark}"
                >
                  介绍
                </p>
                <p
                  class="mb-4 text-lg text-gray-600 dark:text-gray-400"
                  th:text="${'总数:'+#lists.size(categoryList)}"
                >
                  总数
                </p>
              </div>
            </div>
          </CommonTop>
        </th:block>
        <th:block th:unless="column!=null" th:with="bgUrl=${'/nice/static/images/thumbs/'+#numbers.formatDecimal(T(java.lang.Math).floor(T(java.lang.Math).random()*10),1,0)+'.jpg'}">
           <CommonTop bgImg="${bgUrl}">
            <div class="grid grid-cols-6 gap-4">
              <div class="col-start-2 col-span-4 text-center z-10">
                <h1
                  class="inline-block mb-2 text-3xl font-extrabold tracking-tight mt-36 text-gray-900 dark:text-white"
                >
                  分类
                </h1>
                <p class="mb-4 text-lg text-gray-600 dark:text-gray-400">
                  看看是否有你想要查找的分类
                </p>
                <p
                  class="mb-4 text-lg text-gray-600 dark:text-gray-400"
                  th:text="${'分类总数:'+#lists.size(categories)}"
                >
                  总数
                </p>
              </div>
            </div>
          </CommonTop>
        </th:block>
      </LayoutMainTop>
    </LayoutMain>
    <LayoutMainBottom>
      <LayoutMainBottomLeft>
        <CategoryList />
      </LayoutMainBottomLeft>
      <LayoutMainBottomRight>
        <AsideAuthor />

        <AsideComment />

        <AsideNotice />

        <AsideHotTag />

        <AsideArticleList />

        <AsideWebInfo />

      </LayoutMainBottomRight>
    </LayoutMainBottom>
  </th:block>
</th:block>
<CommonTool ></CommonTool>
<LayoutFooter>
  <CommonFooter />
</LayoutFooter>
